package eu.robico.simulator.simulatorinterface.communication;

import static eu.robico.simulator.simulatorinterface.communication.Protocol.Trigger;

import java.io.BufferedWriter;
import java.io.IOException;

class HostWriter 
{
	private BufferedWriter output;
	
	public HostWriter(BufferedWriter output)
	{
		this.output = output;
	}
	
	public void sendTrigger(Trigger trigger) throws IOException
	{
		output.write(trigger.getType() + " " + trigger.getValue());
		output.flush();
	}
	
	public void sendDisconnect() throws IOException
	{
		output.write(Protocol.Type.UPDATE);
		output.flush();
	}
	
	public void close()
	{
		try 
		{
			output.close();
		} 
		catch (IOException e) 
		{
			e.printStackTrace();
		}
	}
}
